<template>
  <div>
    <a-modal
      title="选择工作单位"
      :visible="visible"
      width="70%"
      :maskClosable="false"
      :confirm-loading="confirmLoading"
      @ok="handleOk"
      @cancel="handleCancel"
    >
    <commpVxeTable
      :key="reCommpVxeTable"
      :adaptiveHeight="true"
      :isCanWrap="true"
      :config="dataTableConfig"
      :columns="columnsVxe"
      :formItem="formItem"
      ref="administrativeOffice"
      @searchEvent="searchEvent"
      @resetEvent="resetEvent"
      @radioChange="checkboxChange"
      >
    </commpVxeTable>
    </a-modal>
  </div>
</template>
<script>
import assessCheckApi from './service/api.js'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
export default {
  components:{
      commpVxeTable
  },
  props: {},
  data() {
      return {
          visible: false,
          confirmLoading: false,
          reCommpVxeTable: '',
          dataTableConfig: {
              api: assessCheckApi.pageList,
              rowId: 'id',
              paramet:{
                  gjz: ''
              }
          },
          formItem: [
              {
                  label: '关键字',
                  model: 'gjz',
              },
          ],
          columnsVxe: [
              {
                  type: 'radio',
                  width: 60,
                  fixed: 'left'
              },{
                  title: '单位全称',
                  field: 'fdwqc',
              },{
                  title: '单位地址',
                  field: 'fdwdz',
              },{
                  title: '单位类型',
                  field: 'fdwlx',
              },{
                  title: '所属地市',
                  field: 'fssds',
              },{
                  title: '是否药检所',
                  field: 'fsfyjs',
              },
          ],
          valData: {}
      }
  },
  methods: {
      handleOk(e) {
          this.confirmLoading = true;
          this.visible = false;
          this.confirmLoading = false;
          this.$emit('getSelectionValue',this.valData)
          this.reCommpVxeTable = Date.now()
      },
      handleCancel(e) {
          //console.log('Clicked cancel button');
          this.visible = false;
      },
      // 勾选
      checkboxChange(val){
          //console.log(val.newValue)
          this.valData = val.newValue
      },
      // 搜索
      searchEvent(){
          this.dataTableConfig.paramet = {
              ...this.dataTableConfig.paramet,
          }
          //console.log(this.dataTableConfig.paramet)
      },
      // 重置
      resetEvent(){
          this.dataTableConfig.paramet = {
              ...this.dataTableConfig.paramet,
          }
      },
  },
}
</script>
